<?php
require_once ('/home/n02559308/WWW/Web_Designing/Final/inc/functions.php');

class Users
{
	static function GetAll()
	{
		$conn = GetConnection();
		return $conn->query('SELECT * FROM User');
	}
	
	static function Get($id)
	{
		$conn = GetConnection();
		$results = $conn->query("SELECT * FROM User WHERE id=$id");
		$row = $results->fetch_assoc();
		$conn->close();
		return $row;
	}

	static function Insert()
	{
		
	}
	
	static function Update($row)
	{
		$conn = GetConnection();
		$sql = "UPDATE Users "
			. "SET FristName='$row[FristName]',LastName='$row[LastName]',created_at='$row[created_at]',updated_at='$row[updated_at]' "
			. "WHERE id=$row[id]";
		//echo $sql;
		$results = $conn->query($sql);
		$error->$con->error;
		$conn->close();
		return isset($error) ? array('Server Error'=> $error) : TRUE;
	}
	
	static function Delete()
	{
	}
}

